package com.css.fxfzdzzh.modules.basicData.controller;

import com.css.fxfzdzzh.base.response.RestResponse;
import com.css.fxfzdzzh.modules.basicData.landslideSite.vo.DataPageVO;
import com.css.fxfzdzzh.modules.basicData.param.ClimateParam;
import com.css.fxfzdzzh.modules.basicData.param.sysDataVersion.SysDataVersionPageParam;
import com.css.fxfzdzzh.modules.basicData.service.impl.ClimateService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

/**
 * @author Dbj
 * @date 2023年03月01日  13:38
 */
@Slf4j
@RestController
@RequestMapping("/climate/")
public class ClimateController {

    @Resource
    ClimateService climateService;
    /**
     * 分页条件查询接口
     * */
    @GetMapping("page")
    public RestResponse page(ClimateParam param) {
        try {
            return climateService.page(param);
        } catch (Exception e) {
            log.error(e.getMessage(), e);
            return RestResponse.fail("查询失败!");
        }
    }

    /**
     * 导出
     * @param param
     * @return
     */
    @GetMapping("exportExcel")
    public void exportExcel(HttpServletResponse response, ClimateParam param) throws Exception {
        climateService.exportExcel(response,param);
    }
}
